package com.wsleo.common.utils;

import java.util.Properties;


public final class ConfigLoader {
    
    public final String DB_PATH = "/config/db.properties";
    public final String FREEMARKER_PATH = "/config/freemarker.properties";
	
	private static ConfigLoader configLoader;
	private Properties dbProp;
	private Properties freemarkerProp;

	private ConfigLoader() {
	}

	public static ConfigLoader getInstance() {
		if (configLoader == null) {
			configLoader = new ConfigLoader();
			configLoader.load();
		}
		return configLoader;
	}

	private void load() {
		dbProp = load(DB_PATH);
		freemarkerProp = load(FREEMARKER_PATH);
	}
	
	public static Properties load(String resource) {
		return PropertiesUtil.loadProperties(resource);
	}

	public Properties getDbProp() {
		return dbProp;
	}

	public Properties getFreemarkerProp() {
		return freemarkerProp;
	}

}
